// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: fengyang

#pragma once

// std
#include <map>
#include <memory>
#include <regex>
#include <string>
#include <utility>
#include <vector>

// internal
#include "coin2/base/log.h"
#include "coin2/exchange/base/feed/processor.h"
#include "coin2/exchange/base/market/enums.h"
#include "coin2/exchange/di/constant.h"

namespace coin2::exchange::gateio::feed_v4 {

namespace impl {
using coin2::exchange::base::executor::TopicRecordPacket;
using coin2::exchange::base::symbology::ExchangeType;
using coin2::exchange::base::symbology::MarketType;

class GateioFeedProcessor : public base::feed::FeedParsingProcessor {
 public:
  explicit GateioFeedProcessor(
      const std::string& system_name,
      const coin2::exchange::di::ConstantInjection& ci,
      const feed::RawParserConfig& config,
      const MarketExchangeApi& mea)
      : FeedParsingProcessor(
            system_name,
            mea,
            ci,
            config) {}

  void OnTopicRecord(const TopicRecordPacket& packet) override;

 protected:
  struct FeedTopicStat {
    bool snapshot_received = false;
    bool update_received = false;
  };
  std::unordered_map<std::string, FeedTopicStat> topic_stat_;
};

}  // namespace impl

using impl::GateioFeedProcessor;
}  // namespace coin2::exchange::gateio::feed_v4
